﻿<UserControl x:Class="WikiUploader.Controls.ExcerptUploaderView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             FontFamily="Tahoma"
             FontSize="15"
             d:DesignHeight="500" d:DesignWidth="800">
   
   <Grid>
      <Grid.RowDefinitions>
         <RowDefinition Height="*" />
         <RowDefinition Height="200" />
      </Grid.RowDefinitions>
      
      <Grid Grid.Row="0">
         <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
         </Grid.RowDefinitions>
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.5*" />
            <ColumnDefinition Width="0.5*" />
         </Grid.ColumnDefinitions>
         
         <StackPanel Grid.Row="0"
                     Orientation="Horizontal"
                     Grid.ColumnSpan="2">
            <TextBlock Text="Excerpt"
                       FontWeight="Bold"
                       FontSize="16" />
            <StackPanel Orientation="Horizontal"
                        Margin="5, 0, 5, 0">
               <Button Content="Center"
                       Click="CenterClick"/>
               <Button Content="Small"
                       Margin="5,0,0,0"
                       Click="SmallClick"/>
               <Button Content="Bold"
                       Margin="5,0,0,0"
                       Click="BoldClick" />
               <Button Content="Italic"
                       Margin="5,0,0,0"
                       Click="ItalicClick" />
               <Button Content="Link"
                       Margin="5,0,0,0"
                       Click="LinkClick" />
               <Button Content="Break"
                       Margin="5,0,0,0"
                       Click="BreakClick" />
               <Button Content="Other Link:"
                       Margin="5,0,0,0"
                       Click="OtherLinkClick" />
               <ComboBox x:Name="_cmbOtherLink"
                         Width="150px"
                         Margin="5,0,0,0" />
               <TextBox x:Name="_txtWikipedia"
                        Margin="5,0,0,0"
                        Width="150px" />
               <Button Content="Refersh Other Links"
                       Margin="5,0,0,0"
                       Click="RefreshOtherLinks" />
               <Button Content="Add Other Links"
                       Margin="5,0,0,0"
                       Click="AddOtherLinks" />
            </StackPanel>
         </StackPanel>

         <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="Auto" />
               <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="0.3*" />
               <RowDefinition Height="0.7*" />
            </Grid.RowDefinitions>

            <TextBlock Grid.Row="0"
                       Grid.Column="0"
                       Text="Book:"
                       Margin="4,0,4,0"
                       VerticalAlignment="Center" />
            <TextBox Grid.Row="0"
                     Grid.Column="1"
                     Text="{Binding Path=ExcerptTemplateBook, UpdateSourceTrigger=PropertyChanged}" />

            <TextBlock Grid.Row="1"
                       Grid.Column="0"
                       Text="Chapter:"
                       Margin="4,0,4,0"
                       VerticalAlignment="Center" />
            <TextBox Grid.Row="1"
                     Grid.Column="1"
                     Text="{Binding Path=ExcerptTemplateChapter, UpdateSourceTrigger=PropertyChanged}" />

            <TextBlock Grid.Row="2"
                       Grid.Column="0"
                       Text="Verse:"
                       Margin="4,0,4,0"
                       VerticalAlignment="Center" />
            <Grid Grid.Row="2"
                  Grid.Column="1">
               <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="Auto" />
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="Auto" />
               </Grid.ColumnDefinitions>
               <Button Content="-"
                       Width="20"
                       Grid.Column="0"
                       CommandParameter="-"
                       Command="{Binding Path=EditVerseCommand}"/>
               <TextBox Grid.Column="1"
                        Text="{Binding Path=ExcerptTemplateVerse, UpdateSourceTrigger=PropertyChanged}" />
               <Button Content="+"
                       Width="20"
                       Grid.Column="2"
                       CommandParameter="+"
                       Command="{Binding Path=EditVerseCommand}" />
            </Grid>

            <TextBlock Grid.Row="3"
                       Grid.Column="0"
                       Text="Header:"
                       Margin="4,0,4,0"
                       VerticalAlignment="Center" />
            <TextBox Grid.Row="3"
                     Grid.Column="1"
                     x:Name="_TxtHeader"
                     GotFocus="TxtFocused"
                     Text="{Binding Path=ExcerptTemplateHeader, UpdateSourceTrigger=PropertyChanged}" />

            <TextBlock Grid.Row="4"
                       Grid.Column="0"
                       Text="Footer:"
                       Margin="4,0,4,0"
                       VerticalAlignment="Center" />
            <TextBox Grid.Row="4"
                     Grid.Column="1"
                     x:Name="_TxtFooter"
                     AcceptsReturn="True"
                     GotFocus="TxtFocused"
                     TextWrapping="Wrap"
                     VerticalScrollBarVisibility="Auto"
                     Text="{Binding Path=ExcerptTemplateFooter, UpdateSourceTrigger=PropertyChanged}" />

            <Grid Grid.Row="5"
                  Grid.Column="0">
               <Grid.RowDefinitions>
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
               </Grid.RowDefinitions>
                  <TextBlock Grid.Row="0"
                             Text="Passage:"
                             Margin="4,0,4,0"
                             VerticalAlignment="Top" />
               <Button Grid.Row="1"
                       Margin="0,10,0,0"
                       Content="Clear"
                       Command="{Binding Path=ClearPassageCommand}"/>
               
               <CheckBox Grid.Row="2"
                         Width="60"
                         IsChecked="{Binding Path=ReplaceLineBreaks}"
                         Margin="0,10,0,0"
                         Content="Fix Br" />
            </Grid>
            <TextBox Grid.Row="5"
                     FontSize="16"
                     Grid.Column="1"
                     TextWrapping="Wrap"
                     FontFamily="Consolas"
                     AcceptsReturn="True"
                     x:Name="_TxtPassage"
                     GotFocus="TxtFocused"
                     VerticalScrollBarVisibility="Auto"
                     Text="{Binding Path=ExcerptTemplatePassage, UpdateSourceTrigger=PropertyChanged}" />
         </Grid>

         <Grid Grid.Column="1"
               Grid.Row="1">
            <Grid.RowDefinitions>
               <RowDefinition Height="Auto" />
               <RowDefinition Height="*" />
               <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <TextBlock Grid.Row="0"
                       Text="{Binding Path=ExcerptPageTitle, Mode=TwoWay}" />

            <TextBox Grid.Row="1"
                     Text="{Binding Path=ExcerptContent, Mode=TwoWay}"
                     TextWrapping="Wrap"
                     FontFamily="Consolas"
                     FontSize="16"
                     AcceptsReturn="True"
                     VerticalScrollBarVisibility="Auto"
                     HorizontalScrollBarVisibility="Auto" />

            <Button Grid.Row="2"
                    Content="Upload to Wiki"
                    CommandParameter="Excerpt"
                    Command="{Binding Path=UploadToWikiCommand}" />
         </Grid>
      </Grid>

      <Grid Grid.Row="1">
         <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
         </Grid.RowDefinitions>
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.5*" />
            <ColumnDefinition Width="0.5*" />
         </Grid.ColumnDefinitions>

         <TextBlock Text="Chapter/Article"
                    FontWeight="Bold"
                    FontSize="16"
                    Grid.Row="0" />
         
         <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="Auto" />
               <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="*" />
               <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            
            <TextBlock Grid.Row="0"
                       Grid.Column="0"
                       Text="Book:"
                       Margin="4,0,4,0"
                       VerticalAlignment="Center"/>
            <TextBox Grid.Row="0"
                     Grid.Column="1"
                     Text="{Binding Path=ChapterTemplateBook, UpdateSourceTrigger=PropertyChanged}" />

            <TextBlock Grid.Row="1"
                       Grid.Column="0"
                       Text="Chapter:"
                       Margin="4,0,4,0"
                       VerticalAlignment="Center" />
            <TextBox Grid.Row="1"
                     Grid.Column="1"
                     Text="{Binding Path=ChapterTemplateChapter, UpdateSourceTrigger=PropertyChanged}" />

            <TextBlock Grid.Row="2"
                       Grid.Column="0"
                       Text="Limit:"
                       Margin="4,0,4,0"
                       VerticalAlignment="Center" />
            <TextBox Grid.Row="2"
                     Grid.Column="1"
                     Text="{Binding Path=ChapterTemplateLimit, UpdateSourceTrigger=PropertyChanged}" />

            <TextBlock Grid.Row="3"
                       Grid.Column="0"
                       Text="Prepend:"
                       Margin="4,0,4,0"
                       VerticalAlignment="Center" />
            <TextBox Grid.Row="3"
                     Grid.Column="1"
                     TextWrapping="Wrap"
                     FontFamily="Consolas"
                     FontSize="16"
                     AcceptsReturn="True"
                     VerticalScrollBarVisibility="Auto"
                     Text="{Binding Path=ChapterTemplatePrepend, UpdateSourceTrigger=PropertyChanged}" />

            <TextBlock Grid.Row="4"
                       Grid.Column="0"
                       Text="Append:"
                       Margin="4,0,4,0"
                       VerticalAlignment="Center" />
            <TextBox Grid.Row="4"
                     Grid.Column="1"
                     TextWrapping="Wrap"
                     FontFamily="Consolas"
                     FontSize="16"
                     AcceptsReturn="True"
                     VerticalScrollBarVisibility="Auto"
                     Text="{Binding Path=ChapterTemplateAppend, UpdateSourceTrigger=PropertyChanged}" />
         </Grid>

         <Grid Grid.Column="1"
               Grid.Row="1">
            <Grid.RowDefinitions>
               <RowDefinition Height="Auto" />
               <RowDefinition Height="*" />
               <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            
            <TextBlock Grid.Row="0"
                       Text="{Binding Path=ChapterPageTitle, Mode=TwoWay}" />
            
            <TextBox Grid.Row="1"
                     Text="{Binding Path=ChapterContent, Mode=TwoWay}"
                     TextWrapping="Wrap"
                     FontFamily="Consolas"
                     FontSize="16"
                     AcceptsReturn="True"
                     VerticalScrollBarVisibility="Auto"
                     HorizontalScrollBarVisibility="Auto" />
            
            <Button Grid.Row="2"
                    Content="Upload to Wiki"
                    CommandParameter="Chapter"
                    Command="{Binding Path=UploadToWikiCommand}" />
         </Grid>
      </Grid>
   </Grid>
</UserControl>
